package pl.mcnova.model.entity;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

@Entity
@Table(name = "devices")
public class Device implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -7107917916838236969L;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	private String model;

	private String producer;

	private Integer deviceNumber;

	@ManyToOne
	@JoinColumn(name = "Contractor_Id")
	private Contractor contractor;

	public Device() {

	}

	public Device(String model, String producer, Integer deviceNumber, Contractor contractor) {
		setContractor(contractor);
		setModel(model);
		setProducer(producer);
		setDeviceNumber(deviceNumber);
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public Integer getId() {
		return id;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getModel() {
		return model;
	}

	public void setProducer(String producer) {
		this.producer = producer;
	}

	public String getProducer() {
		return producer;
	}

	public void setContractor(Contractor contractor) {
		this.contractor = contractor;
	}

	public Contractor getContractor() {
		return contractor;
	}

	public void setDeviceNumber(Integer deviceNumber) {
		this.deviceNumber = deviceNumber;
	}

	public Integer getDeviceNumber() {
		return deviceNumber;
	}

	@Override
	public String toString() {
		return getProducer() + " " + getModel();
	}

}
